package com.bw.common.network;

public class RetrofitFactory {

    private static SignRetrofitImpl signRetrofit;
    private static TokenRetrofitImpl tokenRetrofit;
    private static TokenSignRetrofitImpl tokenSignRetrofit;
    private static NomalRetrofitImpl nomalRetrofit;

    public static RetrofitInterface factory(HttpType type){
        RetrofitInterface retrofitInterface = null;
        switch (type){
            case SIGN:
                if (signRetrofit==null){
                    signRetrofit = new SignRetrofitImpl();
                }
                retrofitInterface = signRetrofit;
                break;
            case TOKEN:
                if (tokenRetrofit == null)
                    tokenRetrofit = new TokenRetrofitImpl();
                retrofitInterface = tokenRetrofit;
                break;
            case TOKENSIGN:
                if (tokenSignRetrofit == null)
                    tokenSignRetrofit = new TokenSignRetrofitImpl();
                retrofitInterface = tokenSignRetrofit;
                break;
            default:
                if (nomalRetrofit == null)
                    nomalRetrofit = new NomalRetrofitImpl();
                retrofitInterface = nomalRetrofit;
        }
        return retrofitInterface;
    }

}
